﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Yugi.Client.Card;
namespace Yugi.Client
{
    public partial class SupervisorModel 
    {
        /// <summary>
        /// Bat Dau Battle Phase
        /// </summary>
        /// <param name="param"></param>
        private void ProcessFromServer_TURN_BATTLEPHASE_BEGIN(params object[] param)
        {
            int id = (int)param[0];

            if (id != this.Nguoi_Choi.YPlayer.ID)
            {
                //Khong phai luot Choi cua minh
                this.Turn.ReceiveMessageFromSupervisor(ClientMSG.DoiTurn, EnumTable.BattlePhase);
                return;
            }
            this.TableGame.YStateNow = EnumTable.BattlePhase;
            this.Nguoi_Choi.YStateNow = EnumTable.BattlePhase;
            this.Turn.ReceiveMessageFromSupervisor(ClientMSG.DoiTurn, EnumTable.BattlePhase);
        }

        /// <summary>
        /// //Xoa Bai Sau Khi Thuc Hien tan cong
        /// </summary>
        /// <param name="param"></param>
        private void ProcessFromServer_CARD_XOABAI(params object[] param)
        {
            this.TableGame.ReceiveMessageFromSupervisor(ClientMSG.XoaBai, param);
            this.TableGame.IsProcess = false;
        }

        private void ProcessFromServer_PLAYER_THAYDOIDIEM(params object[] param)
        {
            int player_id = (int)param[0];
            if (player_id == this.Nguoi_Choi.YPlayer.ID)
            {
                this.Nguoi_Choi.ReceiveMessageFromSupervisor(ClientMSG.DoiDiem, param);
            }
            else
            {
                this.Doi_Thu.ReceiveMessageFromSupervisor(ClientMSG.DoiDiem, param);
            }
            MyConsole.WriteLine("Thay Doi Diem " + player_id);
        }
        
        private void ProcessFromServer_TURN_BATTLEPHASE_END(params object[] param)
        {
            this.Nguoi_Choi.ReceiveMessageFromSupervisor(ClientMSG.KetThucBF);
            this.TableGame.ReceiveMessageFromSupervisor(ClientMSG.KetThucBF);
            
        }

       
        private void ProcessFromServer_ANIMATION_CARD_TANCONG(params object[] param)
        {
            this.TableGame.ReceiveMessageFromSupervisor(ClientMSG.DoiThuTanCong, param);
        }

        private void ProcessFromServer_ANIMATION_CARD_TANCONG_TRUCTIEP(params object[] param)
        {
            this.TableGame.ReceiveMessageFromSupervisor(ClientMSG.DoiThuTanCongTrucTiep, param);
        }
    }
}
